/*
    This file is part of the Time-of-Flight Tracer program. It is not part of
    the original PBRT source distribution. See the included license file for
    more information.

    Copyright(c) 2014 Microsoft Corporation

    Author: Phil Pitts
*/

#if defined(_MSC_VER)
#pragma once
#endif

#ifndef PBRT_FILM_BACKSCATTER_SIGNAL_H
#define PBRT_FILM_BACKSCATTER_SIGNAL_H

#define SPEED_LIGHT 299792458

#include "pbrt.h"
#include "film/backscatter.h"

class SignalFilm : public BackscatterFilm {
public:
	SignalFilm(int xres, int yres, const string &fn, vector<float> &frequencies,
		vector<float> &phases);
	~SignalFilm();

	void AddSample(const CameraSample &sample, const PaintData &paint);
	void Splat(const CameraSample &sample, const PaintData &paint);
	void WriteImage(float splatScale);

private:
	float GetKernel(float frequency, float phase, float distance);

	int nFreq, nPhases;
	vector<float> frequencies;
	vector<float> phases;
	BlockedArray<volatile float**> *pixels;		// pixel = nFreq x nPhases matrix
};


SignalFilm *CreateSignalFilm(const ParamSet &params);


#endif // PBRT_FILM_BACKSCATTER_SIGNAL_H


